import React, { Component } from 'react'

export default class App extends Component {
  constructor(props) {
    super(props)

    this.state = {
      movies: ["哈哈", "呵呵"]
    }
  }

  render() {
    return (
      <div>
        <h2>电影列表</h2>
        <ul>
          {
            this.state.movies.map((item, index) => {
              return <li key={index}>{item}</li>
            })
          }
        </ul>
        <button onClick={() => { this.insertMoive() } }>添加电影</button>
      </div>
    )
  }
  
  insertMoive() {
    this.setState({
      movies: [...this.state.movies, "嘻嘻"]
    })
  }
}
